var pattern = "\\[emot:(dy\\d{3})\\]";
var newStr = '<img src="https://shark.douyucdn.cn/app/douyu/res/page/room-normal/face/$1.png?v=20170626">';
var regExp = new RegExp(pattern,'gm');
function chatmsgReplace(txt){
	return txt.replace(regExp,newStr);
}

function  formatDate(now)   {
	var t;
	if(now){
		t = new Date(now);
	} else {
		t = new Date();
	}
    var year=t.getFullYear();
    var month=t.getMonth()+1;
    var date=t.getDate();
    var hour=t.getHours();
    var minute=t.getMinutes();
    var second=t.getSeconds();
    return  year+"-"+buling(month)+"-"+buling(date)+" "+buling(hour)+":"+buling(minute)+":"+buling(second);
}
function buling(a){
    if (a < 10){
        return "0"+a;
    } else {
        return a;
    }
}
